/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package it.trick.admin.binding;

import it.trick.admin.task.GetChannelModelTask;
import it.trick.admin.task.UpdateChannelTask;
import javafx.beans.binding.BooleanBinding;

/**
 *
 * @author takahara
 */
public class SettingChannelProgressBinding extends BooleanBinding {

    private GetChannelModelTask getChannelModelTask;
    private UpdateChannelTask updateChannelTask;

    /**
     * コンストラクタ
     */
    public SettingChannelProgressBinding(
            GetChannelModelTask getChannelModelTask,
            UpdateChannelTask updateChannelTask
            ) {
        this.getChannelModelTask = getChannelModelTask;
        this.updateChannelTask = updateChannelTask;

        super.bind(getChannelModelTask.runningProperty());
        super.bind(updateChannelTask.runningProperty());
    }

    @Override
    protected boolean computeValue() {

        if(getChannelModelTask.runningProperty().getValue()) return true;
        if(updateChannelTask.runningProperty().getValue()) return true;

        return false;
    }
}
